﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link type="text/css" rel="stylesheet" media="all" href="../styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="../styles/global_color.css"/>
    <script language="javascript" type="text/javascript">
        function changeTab(e, ulObj) {
            var obj = e.srcElement || e.target;
            if (obj.nodeName == "A") {
                var links = ulObj.getElementsByTagName("a");
                for (var i = 0; i < links.length; i++) {
                    if (links[i].innerHTML == obj.innerHTML) {
                        links[i].className = "tab_on";
                    }
                    else {
                        links[i].className = "tab_out";
                    }
                }
            }
        }
    </script>
</head>
<body>
<!--Logo区域开始-->
<div id="header">
    <img src="../images/logo.png" alt="logo" class="left"/>
    <a href="/logout">[退出]</a>
</div>
<!--Logo区域结束-->
<!--导航区域开始-->
<div id="navi">
    <ul id="menu">
        <li><a href="/index" class="index_on"></a></li>
        <li id="lia1"><a href="/role_list" class="role_off"></a></li>
        <li id="lia2"><a href="/admin_list" class="admin_off"></a></li>
        <li id="lia3"><a href="/fee_list" class="fee_off"></a></li>
        <li id="lia4"><a href="/account_list" class="account_off"></a></li>
        <li id="lia5"><a href="/service_list" class="service_off"></a></li>
        <li id="lia6"><a href="/bill_list" class="bill_off"></a></li>
        <li id="lia7"><a href="/report_list" class="report_off"></a></li>
        <li><a href="/userInfo" class="information_off"></a></li>
        <li><a href="/userModifyPwd" class="password_off"></a></li>
    </ul>
</div>
<!--导航区域结束-->
<!--主要区域开始-->
<div id="report_main">
    <div class="tabs">
        <ul onclick="changeTab(event,this);">
            <li><a href="#####" class="tab_on" title="每位客户每月的累计时长">客户使用时长</a></li>
            <li><a href="#####" class="tab_out" title="每台服务器上累计时长最高的前三名客户">时长排行榜</a></li>
            <li><a href="#####" class="tab_out" title="每台服务器每种资费标准的使用次数">资费使用率</a></li>
        </ul>
    </div>
    <div class="report_box">
        <!--数据区域：用表格展示数据-->
        <div id="report_data">
            <table id="datalist">
                <tr>
                    <th>账号 ID</th>
                    <th>账务帐号</th>
                    <th>客户名称</th>
                    <th class="width200">身份证号码</th>
                    <th>电话</th>
                    <th class="width150">月份</th>
                    <th class="width150">累积时长</th>
                </tr>

            </table>

        </div>
        <!--分页-->
        <div id="pages">
            <!--<a href="#">首页</a>-->
            <!--<a href="#">上一页</a>-->
            <!--<a href="#" class="current_page">1</a>-->
            <!--<a href="#">2</a>-->
            <!--<a href="#">3</a>-->
            <!--<a href="#">4</a>-->
            <!--<a href="#">5</a>-->
            <!--<a href="#">下一页</a>-->
            <!--<a href="#">末页</a>-->
        </div>

    </div>
</div>
<!--主要区域结束-->
<div id="footer">
    <p>[源自北美的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</p>
    <p>版权所有(C)云科技有限公司 </p>
</div>
</body>
<script src="/js/jquery-3.2.1.js"></script>
<script>
    show();
    accountpage();
    function show() {

        $.ajax({
            url: "/selectAllModules",
            type: "post",
            success: function (result) {

                if (result.indexOf("角色管理") == -1) {
                    document.getElementById("lia1").style.display = "none"
                }
                if (result.indexOf("管理员") == -1) {
                    document.getElementById("lia2").style.display = "none"
                }
                if (result.indexOf("资费管理") == -1) {
                    document.getElementById("lia3").style.display = "none"
                }
                if (result.indexOf("账务账号") == -1) {
                    document.getElementById("lia4").style.display = "none"
                }
                if (result.indexOf("业务账号") == -1) {
                    document.getElementById("lia5").style.display = "none"
                }
                if (result.indexOf("账单管理") == -1) {
                    document.getElementById("lia6").style.display = "none"
                }
                if (result.indexOf("报表") == -1) {
                    document.getElementById("lia7").style.display = "none"
                }


            }

        });
    }
    function accountpage() {
        $.ajax({
            url: "/accountpage",
            method: "post",
            data: {
                pageNum: 1,
                pageSize: 3
            },
            success: function (result) {

                resultData(result);


            }
        });
    }
    function page(pagenum) {
        $.ajax({
            url: "/accountpage",
            type: "post",
            data: {
                pageNum: pagenum,
                pageSize: 3
            },
            success: function (result) {
                resultData(result);
            }
        });
    }


    function resultData(result) {
        console.log(result);
        $("#datalist").html("");
        $("#datalist").append("<tr>" +
                "<th >账号 ID</th>" +
                "<th >账务账号</th>" +
                "<th >客户名称</th>" +
                "<th class='width200'>身份证号码</th>" +
                "<th>电话</th>" +
                "<th class='width150'>月份</th>" +
                "<th class='width150'>累计时长</th>" +
                "</tr>");
        var pagenum = result.pageNum;
        //每页显示几条数据
        var pagesize = result.pageSize;
        var size = result.size;
        var startrow = result.startRow;
        var endrow = result.startRow;
        var total = result.total;
        var pages = result.pages;
        var firstpage = result.firstPage;
        var prepage = result.prePage;
        var nextpage = result.nextPage;
        var lastpage = result.lastPage;
        var isfirstpage = result.isFirstPage;
        var islastpage = result.isLastPage;
        var haspreviouspage = result.hasPreviiousPage;
        var hasnextpage = result.hasNextPage;
        var navigatepages = result.navigatePages;
        var navigatepagenums = result.navigatepageNums;
        var accountList = result.list;

        if (isfirstpage) {
            prepage = firstpage
        }
        if (islastpage) {
            nextpage = lastpage;
        }

        for (var i = 0; i < accountList.length; i++) {
            var account = accountList[i];
            var tr = $("<tr></tr>");
            var accountid = $("<td></td>").text(account.accountId);
            var loginName = $("<td></td>").text(account.loginName);
            var real = $("<td></td>").text(account.realName);
            var card = $("<td></td>").text(account.idcardNo);
            var tele = $("<td></td>").text(account.telephone);
            var month = $("<td></td>").text(account.createDate);
            var leiji = $("<td></td>").text(account.createDate - account.closeDate);
            $("#datalist").append(tr.append(accountid).append(loginName).append(real).append(card).append(tele).append(month).append(leiji));

        }

        $("#pages").html("");
        var a11 = $("<a href='javascript:void(0)' onclick='page(" + firstpage + ")'></a>").text("首页");
        var a12 = $("<a href='javascript:void(0)' onclick='page(" + prepage + ")'></a>").text("上一页");
        $("#pages").append(a11).append(a12);
        for (var k = 1; k <= lastpage; k++) {
            $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + k + ")' >" + k + "</a>"));
        }
        var a13 = $("<a href='javascript:void(0)' onclick='page(" + nextpage + ")'></a>").text("下一页");
        var a14 = $("<a href='javascript:void(0)' onclick='page(" + lastpage + ")'></a>").text("尾页");
        $("#pages").append(a13).append(a14);
    }
</script>
</html>
